package com.run2code.design.behavioral.strategy.demo03;

import com.run2code.design.behavioral.strategy.User;

/**
 * 策略模式 - 福利上下文类
 * 关注公众号【奔跑的码畜】，一起进步不迷路
 *
 * @author 第七人格
 * @date 2023/12/25
 */
public class WelfareContext {
    private WelfareStrategy strategy;

    public void setStrategy(WelfareStrategy strategy) {
        this.strategy = strategy;
    }

    public void sendWelfare(User user) {
        if (strategy != null) {
            strategy.sendWelfare(user);
        } else {
            System.out.println("No welfare strategy found!");
        }
    }
}
